GLib added one-shot variants of the idle/timeout functions a while ago.
While they don't save a lot of code, they serve as a clear marker that
the callback is only invoked once.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3947>
g_free (dir_mtime);
}
-static gboolean
+static void
theme_changed_idle (gpointer user_data)
{
StIconTheme *icon_theme;
g_signal_emit (icon_theme, signals[CHANGED], 0);
icon_theme->theme_changed_idle = 0;
-
- return FALSE;
}
static void
{
if (!icon_theme->theme_changed_idle)
{
- icon_theme->theme_changed_idle = g_idle_add (theme_changed_idle, icon_theme);
+ icon_theme->theme_changed_idle = g_idle_add_once (theme_changed_idle, icon_theme);
g_source_set_name_by_id (icon_theme->theme_changed_idle, "theme_changed_idle");
}
}
pango_font_description_free (font_desc);
}
-static gboolean
-changed_idle (gpointer userdata)
-{
- st_theme_context_changed (userdata);
- return FALSE;
-}
-
static void
on_icon_theme_changed (StTextureCache *cache,
StThemeContext *context)
* icon_name => icon lookup, faking a theme context change is a good way
* to force users such as StIcon to look up icons again.
*/
- id = g_idle_add ((GSourceFunc) changed_idle, context);
- g_source_set_name_by_id (id, "[gnome-shell] changed_idle");
+ id = g_idle_add_once ((GSourceOnceFunc) st_theme_context_changed, context);
+ g_source_set_name_by_id (id, "[gnome-shell] st_theme_context_changed");
}
/**
return next;
}
-static gboolean
+static void
st_widget_update_child_styles (StWidget *widget)
{
StWidgetPrivate *priv = st_widget_get_instance_private (widget);
}
priv->update_child_styles_id = 0;
- return G_SOURCE_REMOVE;
}
static void
if (priv->update_child_styles_id != 0)
return;
- priv->update_child_styles_id = g_idle_add ((GSourceFunc) st_widget_update_child_styles, widget);
+ priv->update_child_styles_id = g_idle_add_once ((GSourceOnceFunc) st_widget_update_child_styles, widget);
}
static void